/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conexion;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author luramirez
 */
public class ConexionFactory {

    private static ConexionFactory conexion;
    private String driverName = "oracle.jdbc.OracleDriver";
    private String conUrl = "jdbc:oracle:thin:@localhost:1521:orcl";
    private Connection conexionOrcl = null;
    private String user = "oe";
    private String psswd = "oracle";

    private ConexionFactory() {
    }

    public Connection getConexion() {
        try {
            Class.forName(driverName);
            conexionOrcl = DriverManager.getConnection(conUrl, user, psswd);
        } catch (ClassNotFoundException | SQLException ex) {
            Logger.getLogger(ConexionFactory.class.getName()).log(Level.SEVERE, null, ex);
        }
        return conexionOrcl;
    }

    public static ConexionFactory getInstance() {
        if (conexion == null) {
            conexion = new ConexionFactory();
        }
        return conexion;
    }
}
